package com.school.model.entity;

// default package
// Generated Sep 24, 2013 10:45:18 AM by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Klasse generated by hbm2java
 */
@Entity
@Table(name = "klasse", catalog = "schoolapp")
public class Klasse implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8144710567878854337L;
	private int id;
	private Schule schule;
	private String name;
	private Set<Schueler> schuelers = new HashSet<Schueler>(0);

	public Klasse() {
	}

	public Klasse(int id, Schule schule) {
		this.id = id;
		this.schule = schule;
	}

	public Klasse(int id, Schule schule, String name, Set<Schueler> schuelers) {
		this.id = id;
		this.schule = schule;
		this.name = name;
		this.schuelers = schuelers;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "Schule_ID", nullable = false)
	public Schule getSchule() {
		return this.schule;
	}

	public void setSchule(Schule schule) {
		this.schule = schule;
	}

	@Column(name = "Name", length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(fetch = FetchType.EAGER, mappedBy = "klasse")
	public Set<Schueler> getSchuelers() {
		return this.schuelers;
	}

	public void setSchuelers(Set<Schueler> schuelers) {
		this.schuelers = schuelers;
	}
}
